<?php
	include("../include/config.php");
	include("../include/functions.php");
	if(isset($_POST['contact_id']) && $_POST['contact_id']==''){
			$pr_id=array_shift($_POST);
			
			
			$_POST['created_date']=date("Y-m-d H:i:s");
			
			$_POST['updated_date']=date("Y-m-d H:i:s");
			
			
			$_POST['contact']=htmlspecialchars(str_replace("'","",$_POST['contact']));
			$_POST['widget']=htmlspecialchars(str_replace("'","",$_POST['widget']));
			
			
			db_insert(DB_PREFIX.'contact',$_POST);
			
			header('location:../admin.php?data=contactpage&msg=success');
			
	}else{
		$product_id=array_shift($_POST);
		
			
		
			$_POST['updated_date']=date("Y-m-d H:i:s");
			
			
			$_POST['contact']=htmlspecialchars(str_replace("'","",$_POST['contact']));
			$_POST['widget']=htmlspecialchars(str_replace("'","",$_POST['widget']));
			db_update(DB_PREFIX.'contact',$_POST,array('contact_id'=>$product_id));
			
			header('location:../admin.php?data=contactpage&msg=updated');
	}
?>